import request from '@/utils/request'

const api_name = '/teach/chapter';
export default {

  //根据课程id查询章节小节信息
  queryChapterVideo(courseId) {
    return request({
      url: `${api_name}/getChapterVideoByCourseId/${courseId}`,
      method: 'get'
    })
  },

  //新增章节
  saveChapter(chapter) {
    return request({
      url: `${api_name}/saveChapter`,
      method: 'post',
      data: chapter
    })
  },

  //根据id查询章节信息
  getChapterById(id) {
    return request({
      url: `${api_name}/getChapterById/${id}`,
      method: 'get'
    })
  },

  //修改章节
  updateChapter(chapter) {
    return request({
      url: `${api_name}/updateChapter/${chapter.id}`,
      method: 'put',
      data: chapter
    })
  },

  //根据id删除章节信息
  removeChapterById(id) {
    return request({
      url: `${api_name}/removeById/${id}`,
      method: 'delete'
    })
  },

}
